import { useSelector,useDispatch } from "react-redux";
import { increment, decrement, addToNum } from '../store/modules/counterStore';
function ItemDemo(props){
    console.log(props,'子组件')
    const { count } = useSelector(state=>state.counter)
    const dispatch = useDispatch()
    return (<div className="flex">
      <button onClick={()=>dispatch(decrement())}>减少</button>
      <div>{count}</div>
      <button onClick={()=>dispatch(increment())}>增加</button>
      <button onClick={()=>dispatch(addToNum(10))}>增加10</button>
    </div>)
  }
  export default ItemDemo